<?php
/**
 * Created by PhpStorm.
 * User: yh
 * Date: 2017/12/8
 * Time: 14:11
 */
namespace app\admin\logic;
use think\Db;
use app\admin\model\Store_log as Store;
class Store_log{

    /**获取模型
     * @return Depar_model|string
     */
    public function Store_log(){
        if (empty($this->Store_log)){
            $this->Store_log = new Store();
        }
        return $this->Store_log;
    }

    /**
     * 保存门店服务记录
     * @param $data : 保存的数据
     * @return mixed
     */
    public function saveStroe($data){
        $res = $this->Store_log()->save($data);
        return $res;
    }

    /**
     * 查看相应订单门店记录
     * @return mixed
     */
    public function selectStore($data){
        $res = $this->Store_log()->where($data)->order('time desc')->select();
        foreach ($res as &$v) {
            $v = $v->append(['mendian_text','menshi_text','state_text','payment_text','nostore_text','msbz','instoreyy_text','photo_grapher_text','operator_text'])
                ->toArray();
        };
        return $res;
    }
}